package com.oa.xinxi.dao;

import com.oa.xinxi.entity.Dep;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.mybatis.spring.annotation.MapperScan;
@MapperScan
public interface DepMapper {
    @Delete({
        "delete from dep",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into dep (id, name)",
        "values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR})"
    })
    int insert(Dep record);

    @InsertProvider(type=DepSqlProvider.class, method="insertSelective")
    int insertSelective(Dep record);

    @Select({
        "select",
        "id, name",
        "from dep",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR)
    })
    Dep selectByPrimaryKey(Integer id);

    @UpdateProvider(type=DepSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Dep record);

    @Update({
        "update dep",
        "set name = #{name,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Dep record);
    @Select({
        "select",
        "id, name",
        "from dep"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR)
    })
    List<Dep> findAll();
}